package com.chushouya.order.constants;


import com.general.framework.core.enums.IEnum;
import com.general.framework.core.exception.Ex;

import java.util.Objects;

public enum AlipaySpiCommerceEnum implements IEnum<String> {

    ESTIMATEPRICE_QUERY("spi.alipay.commerce.recycle.estimateprice.query", "估价接口"),
    RECYCLEORDER_CREATE("spi.alipay.commerce.recycleorder.create", "下单接口"),
    RECYCLEORDER_BASEINFO_QUERY("spi.alipay.commerce.recycleorder.baseinfo.query", "查询订单接口"),
    RECYCLEORDER_DETAILURL_QUERY("spi.alipay.commerce.recycleorder.detailurl.query", "查询订单地址"),
    RECYCLE_DOORTODOOR_CONSULT("spi.alipay.commerce.recycle.doortodoor.consult", "支持上门回收咨询接口"),
    RECYCLE_SOURCE_CONSULT("spi.alipay.commerce.recycle.source.consult", "订单回收方式咨询"),
    RECYCLE_DEVICE_CONSULT("spi.alipay.commerce.recycle.device.consult", "回收设备咨询"),
    USER_OPENCARD("spi.alipay.user.opencard.get", "会员卡开通，获取会员卡信息接口"),
//    支付宝向回收商咨询产品报价 spi.alipay.commerce.recycle.sol.estimateprice.query
    RECYCLE_SOL_ESTIMATEPRICE_QUERY("spi.alipay.commerce.recycle.sol.estimateprice.query", "支付宝向回收商咨询产品报价"),
//    通知创单  spi.alipay.commerce.recycle.sol.order.create
    RECYCLE_SOL_ORDER_CREATE("spi.alipay.commerce.recycle.sol.order.create", "通知创单"),
    ;

    private String value;

    private String desc;

    AlipaySpiCommerceEnum(String value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static AlipaySpiCommerceEnum get(String value) {
        for (AlipaySpiCommerceEnum thisEnum : AlipaySpiCommerceEnum.values()) {
            if (Objects.equals(thisEnum.value, value)) {
                return thisEnum;
            }
        }
        throw Ex.systemError("未定义的枚举[{}]", value);
    }


    @Override
    public String value() {
        return this.value;
    }

    @Override
    public String named() {
        return this.desc;
    }
}
